<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>教师评价</title>
    <link rel="stylesheet" href="https://www.layuicdn.com/layui/css/layui.css">
</head>
<body>
<input type="hidden" id="teacherId">
<input type="hidden" id="evaluateId">
<input type="number" class="layui-input" id="evaluate">
<br>
<input type="button" class="layui-btn" id="save" value="保存">
<script src="https://www.layuicdn.com/layui/layui.js"></script>
<script>
    layui.use(['layer','jquery'], function () {
        var layer = layui.layer;
        var $ = layui.jquery;

        $("#save").click(()=>{
            let evaluate = $("#evaluate").val();
            let teacherId = $("#teacherId").val();
            let evaluateId = $("#evaluateId").val();
            $.post('/teacher/saveEvaluation',{'evaluateId':evaluateId,'evaluateScore':evaluate,'teacherId':teacherId},response=>{
                if (response.code==='200'){
                    parent.layer.msg('评价成功')
                }else {
                    parent.layer.msg('失败')
                }
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index); //再执行关闭
            })

        })
    })
</script>
</body>
</html>